package org.musicsweet.controller;

import org.musicsweet.anotation.AuthReq;
import org.musicsweet.entity.SysDicItem;
import org.musicsweet.result.ResultData;
import org.musicsweet.service.SysDicItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 系统字典项Controller
 */
@RestController
@RequestMapping("/sysDicItem")
public class SysDicItemController{


	@Autowired
	private SysDicItemService sysDicItemService;

	/**
	 * 根据id查询系统字典项
	 *
	 * @param sysDicItem
	 * @return
	 */
	@AuthReq
	@RequestMapping("/getSysDicItemById")
	public ResultData<SysDicItem> getSysDicItemById(@RequestBody SysDicItem sysDicItem) {
		return sysDicItemService.getSysDicItemById(sysDicItem);
	}

	/**
	 * 多条件查询系统字典项
	 *
	 * @param sysDicItem
	 * @return
	 */
	@AuthReq
	@RequestMapping("/getSysDicItemList")
	public ResultData<List<SysDicItem>> getSysDicItemList(@RequestBody SysDicItem sysDicItem) {
		return sysDicItemService.getSysDicItemList(sysDicItem);
	}


	/**
	 * 添加系统字典项
	 *
	 * @param sysDicItem
	 * @param token
	 * @return
	 */
	@RequestMapping("/addSysDicItem")
	public ResultData addSysDicItem(@RequestBody SysDicItem sysDicItem, String token) {
		return sysDicItemService.addSysDicItem(sysDicItem, token);
	}


	/**
	 * 修改系统字典项
	 *
	 * @param sysDicItem
	 * @param token
	 * @return
	 */
	@RequestMapping("/updateSysDicItem")
	public ResultData updateSysDicItem(@RequestBody SysDicItem sysDicItem, String token) {
		return sysDicItemService.updateSysDicItem(sysDicItem, token);
	}


	/**
	 * 删除系统字典项
	 *
	 * @param sysDicItem
	 * @return
	 */
	@RequestMapping("/delSysDicItem")
	public ResultData delSysDicItem(@RequestBody SysDicItem sysDicItem) {
		return sysDicItemService.delSysDicItem(sysDicItem);
	}

}